<?php $this->_extends('_layouts/default_layout'); ?>

<?php $this->_block('title'); ?><?= $title ?><?php $this->_endblock(); ?>
<?php $this->_block('js'); ?>
<script type="text/javascript">
    $(function() {
        $('#btnSave').click(function() {
            $('#mainForm').submit();
        });
    });
</script>
<?php $this->_endblock('js'); ?>

<?php $this->_block('css'); ?>
<style type="text/css">
    .tips {
        font-size: 12px;
        font-weight: normal;
    }

    label {
        font-size: 14px;
        display: inline;
    }

    label.mainLabel{
        display: block;
        font-weight: bold;
    }
</style>
<?php $this->_endblock('css'); ?>

<?php $this->_block('actionBar'); ?>
<button id=btnSave>保存更改</button>
<?php $this->_endblock('actionBar'); ?>

<?php $this->_block('contents'); ?>

<form id="mainForm" action="<?=url('/edit')?>" method="post">
    <input type="hidden" name="lid" value="<?=$l->id()?>">

    <? if (isset($errorMsg)): ?>
    <div class="error"><?=$errorMsg?></div>
    <? endif ?>

    <label for="text" class="mainLabel">链接描述 <span class="require">*</span></label>
    <input name="text" id="text" value="<?=$l->text?>" size="40"/>

    <label for="link" class="mainLabel">
        网址 <span class="require">*</span>
        <span class="tips">sample: http://www.sample.com</span>
    </label>
    <input name="link" id="link" value="<?=$l->link?>" size="80"/>

    <label for="position" class="mainLabel">
        位置 <span class="require">*</span>
        <span class="tips">链接出现的地方</span>
    </label>
    <?=Q::control('radiogroup', 'position', array('items' => Link::positions(), 'value'=>$l->position,'caption_class' => 'm0'))?>

    <label for="sort" class="mainLabel">
        排序 <span class="require">*</span>
    <span class="tips">数字越少排在越前</span>
    </label>
    <input name="sort" id="sort" value="<?=$l->sort?>" size="3"/>

</form>

<?php $this->_endblock(); ?>